<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('专家变动状态申报')" />
</head>
<body class="gray-bg">
    <div class="container-div">
        <div class="row" id="biandongshenbao">

            <!--处理去世导入的-->
            <div v-if="isqushishow">
                <div class="col-sm-12 search-collapse">
                    <form id="formId2">
                        <div class="select-list">
                            <ul>
                                <li>
                                    <label style="width: 100px">专家&nbsp;&nbsp;</label>
                                    <input style="width: 150px !important;" type="text"  v-model="qushi.zhuanjiaxingming"/>
                                </li>
                                <li>
                                    <label style="width: 100px">特贴管理单位&nbsp;&nbsp;</label>
                                    <input style="width: 150px !important;" type="text"  v-model="qushi.danweimingcheng"/>
                                </li>
                                <li>
                                    <label style="width: 180px !important;">特贴管理单位层级&nbsp;&nbsp;</label>
                                    <select style="width: 150px !important;" v-model="qushi.danweicengji" class="form-control" type="text">
                                        <option value="">请选择</option>
                                        <option value="1">一级单位</option>
                                        <option value="2">二级单位</option>
                                        <option value="3">三级单位</option>
                                    </select>
                                </li>
                                <li>
                                    <label style="width: 100px">工作单位&nbsp;&nbsp;</label>
                                    <input style="width: 150px !important;" type="text" v-model="qushi.gongzuodanwei"/>
                                </li>
<!--                                <li>-->
<!--                                    <label style="width: 100px">是否处理&nbsp;&nbsp;</label>-->
<!--                                    <select style="width: 150px !important;"  @change="bindQushiList" class="form-control" v-model="qushi.shifouchuli">-->
<!--                                        <option selected value="0">待处理</option>-->
<!--                                        <option value="1">已处理</option>-->
<!--                                    </select>-->
<!--                                </li>-->
                                <li class="sousuo">
                                    <a class="btn btn-success btn-md" @click="bindQushiList"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                    <a class="btn btn-warning btn-md" @click="refresh"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                </li>
                            </ul>
                        </div>
                    </form>
                </div>

                <div class="col-sm-12 select-table table-striped">
                    <table id="bootstrap-table" class="table table-hover table-primary table-striped">
                        <thead>
                        <tr>
                            <th style="text-align: center; vertical-align: middle;">序号</th>
                            <th style="text-align: center; vertical-align: middle;">专家代码</th>
                            <th style="text-align: center; vertical-align: middle;">专家</th>
                            <th style="text-align: center; vertical-align: middle;">特贴管理单位</th>
                            <th style="text-align: center; vertical-align: middle;">特贴管理单位层级</th>
                            <th style="text-align: center; vertical-align: middle;">工作单位</th>
                            <th style="text-align: center; vertical-align: middle;">是否处理</th>
                            <th style="text-align: center; vertical-align: middle;">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr v-for="(qushiitem,index) in qushilist"  v-if="qushilist.length > 0">
                            <td style="vertical-align: middle; text-align: center;" v-text="index+1"></td>
                            <td style="vertical-align: middle; text-align: center;" v-text="qushiitem.zhuanjiaid"></td>
                            <td style="vertical-align: middle; text-align: center;" v-text="qushiitem.xingming"></td>
                            <td style="vertical-align: middle; text-align: center;" v-text="qushiitem.suoshudanwei"></td>
                            <td style="vertical-align: middle; text-align: center;" v-text="qushiitem.jigoujibie"></td>
                            <td style="vertical-align: middle; text-align: center;" v-text="qushiitem.gongzuodanwei"></td>
                            <td style="vertical-align: middle; text-align: center;" :style="qushiitem.shifouchuli===0?'color:red':'color:green'" :class="qushiitem.shifouchuli===0?'red':'green'" v-text="qushiitem.shifouchuli===0?'待处理':'已处理'"></td>
                            <td style="vertical-align: middle; text-align: center;" >
                                <button class="btn-success btn btn-md" @click="toLianxifangshi(qushiitem)">联系方式</button>
                                <button v-if="qushiitem.shifouchuli==0" class="btn btn-warning btn-md" @click="toHecha(qushiitem)">处理</button>
                                <button v-if="qushiitem.shifouchuli==0" class="btn btn-primary btn-md" @click="HechaSubmit(qushiitem)">提交</button>
                            </td>
                        </tr>
                        <tr v-if="qushilist.length == 0">
                            <td style="text-align: center; vertical-align: middle" colspan="8">查无数据</td>
                        </tr>
                        </tbody>
                    </table>

                    <div v-if="recordCount != '0'" class="my-page-navigation" style="text-align:center;">
                        <button class="btn btn-default" @click="firstPage">首页</button>
                        <button class="btn btn-default" @click="prePage">上一页</button>
                        <select class="custom-select border-secondary" v-model="pagesize">
                            <option value="10">10 条/页</option>
                            <option value="20">20 条/页</option>
                            <option value="30">30 条/页</option>
                            <option value="50">50 条/页</option>
                        </select>
                        <span v-text="pageindex + '  /  ' + pageCount" style="border-color: #6c757d"></span>
                        <span v-text="'共' + recordCount + '条'" style="border-color: #6c757d"></span>
                        <button class="btn btn-default" @click="nextPage">下一页</button>
                        <button class="btn btn-default" @click="lastPage">尾页</button>
                        <span style="border-color: #6c757d">跳到第</span>
                        <input type="text" class="form-control border-secondary" style="width:50px;display:inline;" v-model="targetpage" @keyup.enter="targetPage">
                        <span style="border-color: #6c757d">页</span>
                        <button class="btn btn-default" @click="targetPage">跳</button>
                    </div>
                </div>
            </div>

            <!--变动申报-->
            <div v-if="!isqushishow">
                <div class="col-sm-12 search-collapse">
                    <form id="formId">
                        <div class="select-list">
                            <ul>
                                <li>
                                    <label style="width: 80px !important;">专家&nbsp;&nbsp;</label>
                                    <input style="width: 150px !important;" type="text" name="zhuanjiamingcheng" v-model="zhuanjiamingcheng"/>
                                </li>
                                <li>
                                    <label style="width: 80px !important;">变动类型&nbsp;&nbsp;</label>
                                    <select style="width: 150px !important;" name="biandongleixing" th:with="type=${@dict.getType('sys_zhuanjiazhuangtai')}" v-model="biandongleixing" class="form-control" type="text">
                                        <option value="">请选择</option>
                                        <option value="1">取消享受政府特殊津贴资格</option>
                                        <option value="2">未经组织同意出国半年以上不归</option>
                                        <option value="3">未经原单位组织批准自动离职</option>
                                        <option value="4">直接联系或通过亲属均无法联系</option>
                                        <option value="5">其他原因停发津贴</option>
                                        <option value="6">去世</option>
                                        <option value="7">恢复发放津贴</option>
                                        <option value="9">核增</option>
                                    </select>
                                </li>
                                <li>
                                    <label style="width: 80px !important;">变动日期&nbsp;&nbsp;</label>
                                    <input style="width: 150px !important;" type="text" class="" placeholder="请选择变动开始日期" name="biandongriqikaishi" id="biandongriqikaishi" v-model="biandongriqikaishi" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" @blur="getDate_chaxun"/>
                                    <input style="width: 150px !important;" type="text" class="" placeholder="请选择变动结束日期" name="biandongriqijieshu" id="biandongriqijieshu" v-model="biandongriqijieshu" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" @blur="getDate_chaxun"/>
                                </li>
                                <li class="sousuo">
                                    <a class="btn btn-success btn-md" @click="bindBiandongList"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                    <a class="btn btn-warning btn-md" @click="refresh"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                                </li>
                            </ul>
                        </div>
                    </form>
                </div>

                <div class="col-sm-12 select-table table-striped">

                    <!--列表-->
                    <div class="ibox float-e-margins" style="margin-bottom: 0!important;" >
                        <div class="ibox-title">
                            <h5>当前批次</h5>
                        </div>
                        <div class="ibox-content" style="padding: 0!important;">
                            <div class="panel-body" style="padding-bottom: 0px !important;">
                                <div style="display: flex;flex-wrap: wrap;margin-right: 20px;margin-bottom: 10px" v-for="pici in jingfeipicilist" class="alert alert-success" role="alert">
                                    <div>{{pici.deptname}}:{{pici.picimingcheng}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                    <div style="margin-left: auto">截止时间：{{pici.jiezhishijian}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
                                    <div style="width: 100%;"></div>
                                    <div >年月：</div>
                                    <div  v-for="nianyue in pici.monthlist">
                                        <div style="margin-left: auto;">{{nianyue.nianyue}}&nbsp;&nbsp;</div>
                                    </div>
                                </div>
                            </div>
                            <!---->
                            <div class="panel-body" style="padding-bottom: 0!important;">

                                <div v-if="checkQuerenData==1" style="color: green;margin-left: 10px;font-size: 18px;display: inline;font-family: 'Microsoft YaHei'">本批次专家变动申报已确认</div>
                                <div v-if="checkQuerenData==0" style="color: red;margin-left: 10px;font-size: 18px;display: inline;font-family: 'Microsoft YaHei'">①如有专家变动，请提交;</div>
                                <div style="display: inline;margin-left: 10px;">
                                    <button class="btn btn-primary dim" @click="toAdd" style="margin-top: 10px;">
                                        <i class="fa fa-plus"></i> 更新专家变动信息
                                    </button>
                                </div>
                                <div v-if="checkQuerenData==0" style="color: red;margin-left: 10px;font-size: 18px;display: inline;font-family: 'Microsoft YaHei'">②如无专家变动，请确认本批次无专家变动;</div>
                                <div v-if="checkQuerenData==0" style="display: inline;margin-left: 10px;">
                                    <button class="btn btn-primary dim" @click="queren" style="margin-top: 10px;">
                                        <i class="fa"></i> 确认
                                    </button>
                                </div>

                            </div>

                        </div>
                    </div>

                    <div style="display: flex">
                        <div class="btn-group-md" id="toolbar" role="group">
                           <button class="btn btn-warning dim" @click="Export">
                                <i class="fa fa-download"></i> 导出
                            </button>
                        </div>
                    </div>

                    <!--列表-->
                    <table id="bootstrap-table" class="table table-hover table-primary table-striped" style="margin-top: 10px;grid-column: 1/-1;grid-row: 2;">
                        <thead>
                            <tr>
                                <th style="text-align: center; vertical-align: middle;">序号</th>
                                <th style="text-align: center; vertical-align: middle;">专家代码</th>
                                <th style="text-align: center; vertical-align: middle;">专家</th>
                                <th style="text-align: center; vertical-align: middle;">证件号码</th>
                                <th style="text-align: center; vertical-align: middle;">入选年份</th>
                                <th style="text-align: center; vertical-align: middle;">出生日期</th>
                                <th style="text-align: center; vertical-align: middle;">变动类型</th>
                                <th style="text-align: center; vertical-align: middle;">变动日期</th>
                                <th style="text-align: center; vertical-align: middle;">状态</th>
                                <th style="text-align: center; vertical-align: middle;">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr v-for="(biandongitem,index) in biandonglist"  v-if="biandonglist.length > 0">
                                <td style="vertical-align: middle; text-align: center;" v-text="index+1"></td>
                                <td style="vertical-align: middle; text-align: center;" v-text="biandongitem.zhuanjiaid"></td>
                                <td style="vertical-align: middle; text-align: center;" v-text="biandongitem.xingming"></td>
                                <td style="vertical-align: middle; text-align: center;" v-text="biandongitem.zhengjianhaoma"></td>
                                <td style="vertical-align: middle; text-align: center;" v-text="biandongitem.ruxuannianfen"></td>
                                <td style="vertical-align: middle; text-align: center;" v-text="biandongitem.chushengriqi"></td>
                                <td style="vertical-align: middle; text-align: center;" v-text="biandongitem.biandongleixing_text"></td>
                                <td style="vertical-align: middle; text-align: center;" v-text="biandongitem.biandongshijian"></td>
                                <td style="vertical-align: middle; text-align: center;color:blue;" v-if="biandongitem.isqidong==0">未提交</td>
                                <td style="vertical-align: middle; text-align: center;color:orange;" v-if="biandongitem.isqidong==1&&biandongitem.isjieshu==0">审核中</td>
                                <td style="vertical-align: middle; text-align: center;color:green;" v-if="biandongitem.isjieshu==1">通过</td>
                                <td style="vertical-align: middle; text-align: center;" v-text="">
                                    <!--<button v-if="biandongitem.isqidong==0||biandongitem.isqidong==null" class="btn btn-warning btn-md" @click="toModify(biandongitem.shenbaoid)">修改</button>-->
                                    <button v-if="biandongitem.isqidong==0||biandongitem.isqidong==null" class="btn btn-danger btn-md" @click="Delete(biandongitem.shenbaoid)">删除</button>
                                    <button v-if="biandongitem.isqidong==0||biandongitem.isqidong==null" class="btn btn-primary btn-md" @click="Submit(biandongitem.shenbaoid)">提交</button>
                                    <button class="btn btn-info btn-md" @click="showShenhejiluModel(biandongitem.shiwuid)">审核进度</button>
                                </td>
                            </tr>
                            <tr v-if="biandonglist.length == 0">
                                <td style="text-align: center; vertical-align: middle" colspan="10">查无数据</td>
                            </tr>
                        </tbody>
                    </table>
                    <!--翻页-->
                    <div v-if="recordCount != '0'" class="my-page-navigation" style="text-align:center;margin-left: auto;">
                        <button class="btn btn-default" @click="firstPage">首页</button>
                        <button class="btn btn-default" @click="prePage">上一页</button>
                        <select class="custom-select border-secondary" v-model="pagesize">
                            <option value="10">10 条/页</option>
                            <option value="20">20 条/页</option>
                            <option value="30">30 条/页</option>
                            <option value="50">50 条/页</option>
                        </select>
                        <span v-text="pageindex + '  /  ' + pageCount" style="border-color: #6c757d"></span>
                        <span v-text="'共' + recordCount + '条'" style="border-color: #6c757d"></span>
                        <button class="btn btn-default" @click="nextPage">下一页</button>
                        <button class="btn btn-default" @click="lastPage">尾页</button>
                        <span style="border-color: #6c757d">跳到第</span>
                        <input type="text" class="form-control border-secondary" style="width:50px;display:inline;" v-model="targetpage" @keyup.enter="targetPage">
                        <span style="border-color: #6c757d">页</span>
                        <button class="btn btn-default" @click="targetPage">跳</button>
                    </div>
                </div>
            </div>

            <!--联系方式-->
            <div th:fragment="lianxifangshi">
                <div id="lianxifangshiModal" style="" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2" aria-hidden="true" data-keyboard="false">
                    <div class="modal-dialog modal-md" style="width:1000px;">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal"
                                        aria-hidden="true">&times;</button>
                                <h4 class="modal-title" id="myModalLabel2"></h4>
                            </div>
                            <div class="modal-body" style="overflow: auto;">

                                <!--专家联系方式-->
                                <table id="bootstrap-table" class="table table-hover table-primary table-striped">
                                    <thead>
                                    <tr>
                                        <th colspan="2" style="text-align: center; vertical-align: middle;">专家联系方式</th>
                                    </tr>
                                    </thead>
                                    <tr>
                                        <td style="vertical-align: middle; text-align: center;">手机</td>
                                        <td style="vertical-align: middle; text-align: center;" v-if="zhanghuxinxi.shoujihaoma!=null" v-text="zhanghuxinxi.shoujihaoma"></td>
                                        <td style="vertical-align: middle; text-align: center;" v-else>暂无</td>
                                    </tr>
                                    <tr>
                                        <td style="vertical-align: middle; text-align: center;">电话号码</td>
                                        <td style="vertical-align: middle; text-align: center;" v-if="zhanghuxinxi.dianhuahaoma!=null" v-text="zhanghuxinxi.dianhuahaoma"></td>
                                        <td style="vertical-align: middle; text-align: center;" v-else>暂无</td>
                                    </tr>
                                    <tr>
                                        <td style="vertical-align: middle; text-align: center;">电子邮件</td>
                                        <td style="vertical-align: middle; text-align: center;" v-if="zhanghuxinxi.dianziyoujian!=null" v-text="zhanghuxinxi.dianziyoujian"></td>
                                        <td style="vertical-align: middle; text-align: center;" v-else>暂无</td>
                                    </tr>
                                    <tr>
                                        <td style="vertical-align: middle; text-align: center;">邮编</td>
                                        <td style="vertical-align: middle; text-align: center;" v-if="zhanghuxinxi.youbian!=null" v-text="zhanghuxinxi.youbian"></td>
                                        <td style="vertical-align: middle; text-align: center;" v-else>暂无</td>
                                    </tr>
                                </table>

                                <!--单位联系方式-->
                                <table id="bootstrap-table" class="table table-hover table-primary table-striped">
                                    <thead>
                                    <tr>
                                        <th style="text-align: center; vertical-align: middle;">单位</th>
                                        <th style="text-align: center; vertical-align: middle;">单位层级</th>
                                        <th style="text-align: center; vertical-align: middle;">经办人</th>
                                        <th style="text-align: center; vertical-align: middle;">手机</th>
                                        <th style="text-align: center; vertical-align: middle;">办公电话</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr v-for="(zhanghaoxinxiItem,index) in zhanghaoxinxiList"  v-if="zhanghaoxinxiList.length > 0">
                                        <td style="vertical-align: middle; text-align: center;" v-text="zhanghaoxinxiItem.deptname"></td>
                                        <td style="vertical-align: middle; text-align: center;" v-if="zhanghaoxinxiItem.deptlevel==1">一级单位</td>
                                        <td style="vertical-align: middle; text-align: center;" v-else-if="zhanghaoxinxiItem.deptlevel==2">二级单位</td>
                                        <td style="vertical-align: middle; text-align: center;" v-else-if="zhanghaoxinxiItem.deptlevel==3">三级单位</td>
                                        <td style="vertical-align: middle; text-align: center;" v-else></td>
                                        <td style="vertical-align: middle; text-align: center;" v-text="zhanghaoxinxiItem.jingbanren"></td>
                                        <td style="vertical-align: middle; text-align: center;" v-text="zhanghaoxinxiItem.jingbanrenshouji"></td>
                                        <td style="vertical-align: middle; text-align: center;" v-text="zhanghaoxinxiItem.jingbanrenbangongdianhua"></td>
                                    </tr>
                                    <tr v-if="zhanghaoxinxiList.length == 0">
                                        <td style="text-align: center; vertical-align: middle" colspan="6">查无数据</td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 审核记录-->
            <div th:replace="system/zhuanjia/modal_shenhejilu::shenhejilu"></div>
            <!-- 编辑专家变动信息 -->
            <div th:replace="system/zhuanjia/modal_shenbaoedit::modal_shenbaoedit"></div>
            <!-- 编辑专家变动信息 -->
            <div th:replace="system/zhuanjia/modal_hechaedit::modal_hechaedit"></div>

        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: WdatePicker" />
    <script th:src="@{/js/plupload/plupload.js?v=1.0}"></script>
    <script th:src="@{/js/plupload/plupload.full.js?v=1.0}"></script>
    <script th:src="@{/js/upload_fujian.js?v=1.1}"></script>
    <script>
        $(function() {
            InitUpLoader();
        });

        var vm_biandongshenbao = new Vue({
            el : "#biandongshenbao",
            data : {
                deptid : $("#deptid").val(),		// 单位ID
                deptname : $("#deptname").val(),		// 单位ID

                //查询用字段
                zhuanjiamingcheng : '',
                biandongleixing : '',
                biandongriqikaishi : '',
                biandongriqijieshu : '',

                jingfeipicilist : [],//经费批次ID
                biandonglist : [],//专家变动列表
                zhuanjialist : [],//本单位专家列表
                shenhejilulist : [],//审核记录

                zhanghuxinxi:{},//专家信息
                zhanghaoxinxiList:[],

                qushi:{
                    danweimingcheng: "",
                    danweicengji: "",
                    zhuanjiaxingming: "",
                    gongzuodanwei: "",
                    shifouchuli: 0,
                    chuliriqi: "",
                },

                qushione:{},//去世对象
                biandong : {},//变动申报对象
                yuanyin : '',

                pageindex : 1,		// 查询分页初始化页
                pagesize : 10,		// 查询分页初始化页面大小
                pageCount : 0,		// 总页数
                recordCount : 0,	// 总记录数
                targetpage : '', 	// 目标页

                //编辑框
                zhuanjianame : '',//查询专家名字

                editflag : '',//1添加 2修改
                isqushishow : false,

                checkQuerenData: '0',//是否确认变动
            },
            created : function(){

                var _this = this;
                _this.bindZhuanjiaList();

                $.post('/system/renkouhecha/qushilist', {
                    jigoudaima : _this.deptid,
                    danweimingcheng: _this.qushi.danweimingcheng,
                    danweicengji: _this.qushi.danweicengji,
                    zhuanjiaxingming: _this.qushi.zhuanjiaxingming,
                    gongzuodanwei: _this.qushi.gongzuodanwei,
                    shifouchuli: 0,
                    chuliriqi: _this.qushi.chuliriqi,
                    pageindex: _this.pageindex,
                    pagesize: _this.pagesize,
                }, function (ppData) {
                    if (ppData.result == "1") {
                        var data = ppData.resultContent;
                        _this.qushilist = data.list;
                        if(data.PageInfo.recordCount!=0)_this.isqushishow=true
                        else _this.isqushishow=false
                        if(_this.isqushishow==false) _this.bindBiandongList();
                        var pageInfo = data.PageInfo;
                        _this.pageindex = pageInfo.pageIndex;
                        _this.pageCount = pageInfo.pageCount;
                        _this.recordCount = pageInfo.recordCount;
                        _this.targetpage = '';

                    }
                }, "json");

                _this.checkQueren();
                _this.bindJingfeiPiciList();
            },
            watch : {
            },
            methods : {

                // 去世list
                bindQushiList : function(){
                    var _this = this;
                    $.post('/system/renkouhecha/qushilist', {
                        jigoudaima : _this.deptid,
                        danweimingcheng: _this.qushi.danweimingcheng,
                        danweicengji: _this.qushi.danweicengji,
                        zhuanjiaxingming: _this.qushi.zhuanjiaxingming,
                        gongzuodanwei: _this.qushi.gongzuodanwei,
                        shifouchuli: _this.qushi.shifouchuli,
                        chuliriqi: 0,
                        pageindex: _this.pageindex,
                        pagesize: _this.pagesize,
                    }, function (ppData) {
                        if (ppData.result == "1") {
                            var data = ppData.resultContent;
                            _this.qushilist = data.list;
                            var pageInfo = data.PageInfo;
                            _this.pageindex = pageInfo.pageIndex;
                            _this.pageCount = pageInfo.pageCount;
                            _this.recordCount = pageInfo.recordCount;
                            _this.targetpage = '';
                        }
                    }, "json");
                },


                //绑定当前与本单位有关的经费批次
                bindJingfeiPiciList : function(){
                    var _this = this;

                    var jingfeipici_layer = layer.open({type:3});
                    $.post('/system/jingfeipici/findwffbydeptid', {
                        deptid : _this.deptid,
                        rdm : Math.random()
                    },function(ppData) {
                        layer.close(jingfeipici_layer);

                        if (ppData != null) {
                            if (ppData.result==1){
                                var data = ppData.resultContent;
                                _this.jingfeipicilist = data;
                            }else{
                                layer.alert(ppData.message);
                            }
                        }
                    },"json");
                },

                //检查当前单位是否确认本批次变动情况
                checkQueren:function(){
                    var _this = this;

                    var biandong_layer = layer.open({type:3});
                    $.post('/system/danweiqueren/checkqueren', {
                        deptid : _this.deptid,
                        rdm : Math.random()
                    },function(ppData) {
                        layer.close(biandong_layer);

                        if (ppData != null) {
                            var data = ppData;
                            _this.checkQuerenData = data.resultContent;
                        }
                    },"json");
                },

                queren:function(){
                    var _this = this;

                    if (confirm("是否确认本批专家变动？")) {

                        var biandong_layer = layer.open({type:3});
                        $.post('/system/danweiqueren/queren', {
                            deptid: _this.deptid,
                            rdm: Math.random()
                        }, function (ppData) {
                            layer.close(biandong_layer);

                            if (ppData != null) {
                                if (ppData.result == 1) {
                                    layer.alert("提交成功");
                                    _this.refresh();
                                } else {
                                    layer.alert(ppData.message);
                                }
                            }
                        }, "json");
                    }
                },

                // 根据单位ID查询专家变动申请信息
                bindBiandongList : function(){
                    var _this = this;

                    var biandong_layer = layer.open({type:3});
                    $.post('/system/biandongshenbao/custombiandonglist', {
                        deptid : _this.deptid,
                        zhuanjiamingcheng : _this.zhuanjiamingcheng,
                        biandongleixing : _this.biandongleixing,
                        biandongriqikaishi : _this.biandongriqikaishi,
                        biandongriqijieshu : _this.biandongriqijieshu,
                        pageindex : _this.pageindex,
                        pagesize : _this.pagesize,
                        rdm : Math.random()
                    },function(ppData) {
                        layer.close(biandong_layer);

                        if (ppData != null) {
                            var data = ppData.resultContent;
                            _this.biandonglist = data.biandonglist;

                            var pageInfo = data.PageInfo;
                            _this.pageindex = pageInfo.pageIndex;
                            _this.pageCount = pageInfo.pageCount;
                            _this.recordCount = pageInfo.recordCount;
                            _this.targetpage = '';
                        }
                    },"json");
                },

                //首页
                firstPage : function(){
                    this.pageindex = 1;
                },
                //尾页
                lastPage : function(){
                    this.pageindex = this.pageCount;
                },
                //上一页
                prePage : function(){
                    var prePage = ((this.pageindex -1) <= 0) ? 1 : (this.pageindex -1);
                    this.pageindex = prePage;
                },
                //下一页
                nextPage : function(){
                    var nextPage = ((this.pageindex +1) >= this.pageCount) ? this.pageCount : (this.pageindex +1);
                    this.pageindex = nextPage;
                },
                //跳到目标页
                targetPage : function() {
                    if( this.targetpage != '' && this.targetpage <= this.pageCount && this.targetpage > 0){
                        this.pageindex = this.targetpage;
                        this.targetpage = '';
                    }
                },

                //绑定专家列表
                bindZhuanjiaList : function(){
                    var _this = this;

                    var biandong_layer = layer.open({type:3});
                    $.post('/system/zhuanjiadept/findbydeptid', {
                        deptid : _this.deptid,
                        zhuanjianame : _this.zhuanjianame,
                        rdm : Math.random()
                    },function(ppData) {
                        layer.close(biandong_layer);

                        if (ppData != null) {
                            var data = ppData;
                            _this.zhuanjialist = data;
                        }
                    },"json");
                },

                toAdd:function(){
                    var _this = this;

                    $("#myModalLabel").html("新增专家变动申报");
                    $("#modal-dialog").attr("style", "width:1200px;");
                    $("#shenbaoModal").modal();

                    //编辑框专家搜索置空
                    _this.zhuanjianame = '';
                    //绑定本单位专家
                    _this.bindZhuanjiaList();

                    //变动置空
                    _this.biandong = {};

                    //上传附件
                    $("#fujianurl").val("");
                    $("#filelist").empty();

                    //编辑标记
                    _this.editflag = 1;
                },

                //添加
                add:function(){
                    var _this = this;

                    if (_this.biandong.biandongleixing==='1'){
                        _this.yuanyin = _this.biandong.quxiao_yuanyin;
                    }else if (_this.biandong.biandongleixing==='4'){
                        _this.yuanyin = _this.biandong.shilian_yuanyin;
                    }else if (_this.biandong.biandongleixing==='5'){
                        _this.yuanyin = _this.biandong.tingfa_yuanyin;
                    }else if (_this.biandong.biandongleixing==='7'||_this.biandong.biandongleixing==='9'){
                        _this.yuanyin = _this.biandong.huifu_yuanyin;
                    }

                    if (_this.checkInputData()) {
                        var biandong_layer = layer.open({type: 3});
                        $.post('/system/biandongshenbao/save', {
                            //shenbao
                            biandongleixing:_this.biandong.biandongleixing,
                            biandongshijian:_this.biandong.biandongshijian,
                            zhuanjiaid:_this.biandong.zhuanjiaid,
                            deptid:_this.deptid,
                            //quxiao
                            biandongshijian:_this.biandong.biandongshijian,
                            //chuguo
                            biandongshijian:_this.biandong.biandongshijian,
                            chuguoshijian:_this.biandong.chuguo_chuguoshijian,
                            //lizhi
                            biandongshijian:_this.biandong.biandongshijian,
                            lizhishijian:_this.biandong.lizhi_lizhishijian,
                            //shilian
                            biandongshijian:_this.biandong.biandongshijian,
                            //tingfa
                            biandongshijian:_this.biandong.biandongshijian,
                            //qushi
                            biandongshijian:_this.biandong.biandongshijian,
                            //huifu
                            tingfaleixing:_this.biandong.huifu_tingfaleixing,
                            tingfashijian:_this.biandong.huifu_tingfashijian,
                            shifoutingfagongzi:_this.biandong.huifu_shifoutingfagongzi,
                            tingfagongziyuanyin:_this.biandong.huifu_tingfagongziyuanyin,
                            shifouquxiaozige:_this.biandong.huifu_shifouquxiaozige,
                            beizhu:_this.biandong.huifu_quxiaozigeyuanyin,
                            biandongshijian:_this.biandong.biandongshijian,
                            //hezeng
                            xingming:_this.biandong.xingming,
                            xingbie:_this.biandong.xingbie,
                            chushengriqi:_this.biandong.chushengriqi,
                            guoji:_this.biandong.guoji,
                            zhengjianleixing:_this.biandong.zhengjianleixing,
                            zhengjianhaoma:_this.biandong.zhengjianhaoma,
                            shoujihaoma:_this.biandong.shoujihaoma,
                            ruxuannianfen:_this.biandong.ruxuannianfen,
                            lianxiren1:_this.biandong.lianxiren1,
                            lianxidianhua1:_this.biandong.lianxidianhua1,
                            guanxi1:_this.biandong.guanxi1,
                            lianxiren2:_this.biandong.lianxiren2,
                            lianxidianhua2:_this.biandong.lianxidianhua2,
                            guanxi2:_this.biandong.guanxi2,
                            lianxiren3:_this.biandong.lianxiren3,
                            lianxidianhua3:_this.biandong.lianxidianhua3,
                            guanxi3:_this.biandong.guanxi3,
                            yinhangmingcheng:_this.biandong.yinhangmingcheng,
                            yinhangkahao:_this.biandong.yinhangkahao,
                            lianhanghao:_this.biandong.lianhanghao,
                            //fujian
                            filepath : $("#fujianurl").val(),
                            yuanyin:_this.yuanyin,
                            rdm: Math.random()
                        }, function (ppData) {
                            layer.close(biandong_layer);
                            if (ppData != null) {
                                if (ppData.result == "1") {
                                    layer.open({
                                        time: 1000,
                                        btn: [],
                                        content: "保存成功!",
                                    });
                                    _this.bindBiandongList();
                                    $("#shenbaoModal").modal('hide');
                                } else {
                                    layer.alert(ppData.message);
                                }
                            }
                        }, "json");
                    }
                },

                toModify:function(ppBiandongId){

                    $("#myModalLabel").html("修改专家变动信息");
                    $("#modal-dialog").attr("style","width:1200px;");
                    $("#shenbaoModal").modal();

                    this.zhuanjianame = '';
                    this.bindZhuanjiaList();

                    this.biandongid = ppBiandongId;

                    this.biandong = {};
                    this.editflag = 2;
                    // 绑定变动
                    this.bindBiandong();
                },

                toHecha:function(qushiitem){

                    $("#myModalLabel").html("核查专家去世信息");
                    $("#modal-dialog").attr("style","width:1200px;");
                    $("#hechaModal").modal();

                    this.zhuanjianame = '';
                    this.bindZhuanjiaList();

                    this.biandongid = qushiitem.biandongid;

                    this.biandong = {};
                    this.editflag = 2;
                    // 绑定变动
                    this.bindBiandong();
                },

                bindBiandong : function(){
                    var _this = this;

                    var biandong_layer = layer.open({type:3});
                    $.post('/system/biandongshenbao/findcustomone', {
                        shenbaoid : _this.biandongid,
                        rdm : Math.random()
                    },function(ppData) {
                        layer.close(biandong_layer);

                        if(ppData != null){

                            if(ppData.result == "1"){
                                var data = ppData.resultContent;
                                _this.biandong = data;
                                _this.biandong.id = _this.biandongid;
                            }else{
                                layer.alert(ppData.message);
                            }
                        }
                    },"json");
                },

                modify:function(){
                    var _this = this;

                    if (_this.biandong.biandongleixing==='1'){
                        _this.yuanyin = _this.biandong.quxiao_yuanyin;
                    }else if (_this.biandong.biandongleixing==='4'){
                        _this.yuanyin = _this.biandong.shilian_yuanyin;
                    }else if (_this.biandong.biandongleixing==='5'){
                        _this.yuanyin = _this.biandong.tingfa_yuanyin;
                    }else if (_this.biandong.biandongleixing==='7'||_this.biandong.biandongleixing==='9'){
                        _this.yuanyin = _this.biandong.huifu_yuanyin;
                    }

                    if (_this.checkInputData()) {
                        var biandong_layer = layer.open({type: 3});
                        $.post('/system/biandongshenbao/save', {
                            shenbaoid:_this.biandongid,
                            //shenbao
                            biandongleixing:_this.biandong.biandongleixing,
                            biandongshijian:_this.biandong.biandongshijian,
                            zhuanjiaid:_this.biandong.zhuanjiaid,
                            deptid:_this.deptid,
                            //quxiao
                            biandongshijian:_this.biandong.biandongshijian,
                            //chuguo
                            biandongshijian:_this.biandong.biandongshijian,
                            chuguoshijian:_this.biandong.chuguo_chuguoshijian,
                            //lizhi
                            biandongshijian:_this.biandong.biandongshijian,
                            lizhishijian:_this.biandong.lizhi_lizhishijian,
                            //shilian
                            biandongshijian:_this.biandong.biandongshijian,
                            //tingfa
                            biandongshijian:_this.biandong.biandongshijian,
                            //qushi
                            biandongshijian:_this.biandong.biandongshijian,
                            //huifu
                            tingfaleixing:_this.biandong.huifu_tingfaleixing,
                            tingfashijian:_this.biandong.huifu_tingfashijian,
                            shifoutingfagongzi:_this.biandong.huifu_shifoutingfagongzi,
                            tingfagongziyuanyin:_this.biandong.huifu_tingfagongziyuanyin,
                            shifouquxiaozige:_this.biandong.huifu_shifouquxiaozige,
                            beizhu:_this.biandong.huifu_quxiaozigeyuanyin,
                            biandongshijian:_this.biandong.biandongshijian,
                            //hezeng
                            xingming:_this.biandong.xingming,
                            xingbie:_this.biandong.xingbie,
                            chushengriqi:_this.biandong.chushengriqi,
                            guoji:_this.biandong.guoji,
                            zhengjianleixing:_this.biandong.zhengjianleixing,
                            zhengjianhaoma:_this.biandong.zhengjianhaoma,
                            shoujihaoma:_this.biandong.shoujihaoma,
                            ruxuannianfen:_this.biandong.ruxuannianfen,
                            lianxiren1:_this.biandong.lianxiren1,
                            lianxidianhua1:_this.biandong.lianxidianhua1,
                            guanxi1:_this.biandong.guanxi1,
                            lianxiren2:_this.biandong.lianxiren2,
                            lianxidianhua2:_this.biandong.lianxidianhua2,
                            guanxi2:_this.biandong.guanxi2,
                            lianxiren3:_this.biandong.lianxiren3,
                            lianxidianhua3:_this.biandong.lianxidianhua3,
                            guanxi3:_this.biandong.guanxi3,
                            yinhangmingcheng:_this.biandong.yinhangmingcheng,
                            yinhangkahao:_this.biandong.yinhangkahao,
                            lianhanghao:_this.biandong.lianhanghao,
                            //fujian
                            filepath : $("#fujianurl").val(),
                            yuanyin:_this.yuanyin,
                            rdm: Math.random()
                        }, function (ppData) {
                            layer.close(biandong_layer);
                            if (ppData != null) {
                                if (ppData.result == "1") {
                                    layer.open({
                                        time: 1000,
                                        btn: [],
                                        content: "保存成功!",
                                    });
                                    _this.bindBiandongList();
                                    $("#shenbaoModal").modal('hide');
                                    $("#hechaModal").modal('hide');
                                } else {
                                    layer.alert(ppData.message);
                                }
                            }
                        }, "json");
                    }
                },

                Submit:function(id){
                    var _this = this;

                    var biandong_layer = layer.open({type:3});
                    $.post('/system/renwu/submit_custom', {
                        id : id,
                        deptid : _this.deptid,
                        rdm : Math.random()
                    },function(ppData) {
                        layer.close(biandong_layer);

                        if (ppData != null) {
                            var result = ppData.result;
                            if (result==="1"){
                                layer.open({
                                time: 1000,
                                btn: [],
                                content: "提交成功!",
                            });
                            // _this.bindQushiList();
                            // _this.bindBiandongList();
                                location.reload();
                            }else{
                                layer.alert(ppData.message);
                            }
                        }
                    },"json");
                },

                HechaSubmit:function(qushiitem){
                    var _this = this;

                    var biandong_layer = layer.open({type:3});

                    if (_this.biandong.biandongleixing=='6'){//去世，就提交变动
                        $.post('/system/renwu/submit_custom', {
                            id : qushiitem.biandongid,
                            deptid : _this.deptid,
                            rdm : Math.random()
                        },function(ppData) {
                            layer.close(biandong_layer);

                            if (ppData != null) {
                                var result = ppData.result;
                                if (result==="1"){
                                    layer.open({
                                        time: 1000,
                                        btn: [],
                                        content: "提交成功!",
                                    });
                                    location.reload();
                                }else{
                                    layer.alert(ppData.message);
                                }
                            }
                        },"json");
                    }else {//健在，就在专家表里添加变动“仍健在”
                        $.post('/system/zhuanjia/hechajianzai', {
                            biandongid : qushiitem.biandongid,
                            zhuanjiaid : qushiitem.zhuanjiaid,
                            beizhu1 : "仍健在",
                            rdm : Math.random()
                        },function(ppData) {
                            layer.close(biandong_layer);

                            if (ppData != null) {
                                var result = ppData.result;
                                if (result==="1"){
                                    layer.alert("提交成功！",{icon:1,clostBtn:0},function(){
                                        location.reload();
                                    });
                                }else{
                                    layer.alert(ppData.message);
                                }
                            }
                        },"json");
                    }
                },

                Delete:function(id){
                    var _this = this;

                    if (confirm("是否删除专家变动？")) {
                        var biandong_layer = layer.open({type: 3});
                        $.post('/system/biandongshenbao/remove', {
                            ids: id,
                            rdm: Math.random()
                        }, function (ppData) {
                            layer.close(biandong_layer);

                                var result = ppData.code;
                                if (result == 0) {
                                    layer.open({
                                        time: 1000,
                                        btn: [],
                                        content: "删除成功!",
                                    });
                                    // _this.bindQushiList();
                                    _this.bindBiandongList();
                                    //location.reload();
                                } else {
                                    layer.alert(ppData.msg);
                                }
                        }, "json");
                    }
                },

                /*工具*/
                checkInputData:function(){
                    return true;
                },

                refresh:function(){

                    var _this = this;
                    _this.zhuanjiamingcheng = '';
                    _this.biandongleixing = '';
                    _this.biandongriqikaishi = '';
                    _this.biandongriqijieshu = '';

                    _this.checkQueren();
                    _this.bindBiandongList();
                },

                getDate_chaxun:function(){
                    var _this = this;

                    _this.biandongriqikaishi=$("#biandongriqikaishi").val();
                    _this.biandongriqijieshu=$("#biandongriqijieshu").val();
                },

                getDate_biandongshijian:function(){
                    var _this = this;

                    if (_this.biandong.biandongleixing=='1'){
                        _this.biandong.biandongshijian=$("#quxiao_biandongshijian").val();
                    }else if(_this.biandong.biandongleixing=='2'){
                        _this.biandong.biandongshijian=$("#chuguo_biandongshijian").val();
                        _this.biandong.chuguo_chuguoshijian=$("#chuguoshijian").val();
                    }else if(_this.biandong.biandongleixing=='3'){
                        _this.biandong.biandongshijian=$("#lizhi_biandongshijian").val();
                        _this.biandong.lizhi_lizhishijian=$("#lizhishijian").val();
                    }else if(_this.biandong.biandongleixing=='4'){
                        _this.biandong.biandongshijian=$("#shilian_biandongshijian").val();
                    }else if(_this.biandong.biandongleixing=='5'){
                        _this.biandong.biandongshijian=$("#tingfa_biandongshijian").val();
                    }else if(_this.biandong.biandongleixing=='6'){
                        _this.biandong.biandongshijian=$("#qushi_biandongshijian").val();
                    }else if(_this.biandong.biandongleixing=='7'){
                        _this.biandong.huifu_tingfashijian=$("#tingfashijian").val();
                        _this.biandong.biandongshijian=$("#huifu_biandongshijian").val();
                    }else if(_this.biandong.biandongleixing=='8'){

                    }else if(_this.biandong.biandongleixing=='9'){
                        _this.biandong.chushengriqi=$("#chushengriqi").val();
                        _this.biandong.ruxuannianfen=$("#ruxuannianfen").val();
                        _this.biandong.huifu_tingfashijian=$("#tingfashijian").val();
                        _this.biandong.biandongshijian=$("#huifu_biandongshijian").val();
                    }
                },

                showShenhejiluModel:function(ppShiwuId){
                    var _this = this;

                    $("#shenhejiluModalLabel").html("审核进度");
                    $("#shenhejiluModal").modal();

                    _this.bindShenhejilu(ppShiwuId);
                },

                bindShenhejilu:function(ppShiwuId){
                    var _this = this;

                    var biandong_layer = layer.open({type:3});
                    $.post('/system/renwu/findspjl', {
                        shiwuid : ppShiwuId,
                        rdm : Math.random()
                    },function(ppData) {
                        layer.close(biandong_layer);

                        if (ppData != null) {
                            var data = ppData;
                            _this.shenhejilulist = data.resultContent;
                        }
                    },"json");
                },

                toLianxifangshi:function (zhuanjiaitem) {
                    var _this = this;
                    _this.zhanghuxinxi = zhuanjiaitem

                    $.post('/system/deptxinxi/findLianxifangshi', {
                        deptid: zhuanjiaitem.jigoudaima,
                        rdm: Math.random()
                    }, function (ppData) {
                        if (ppData != null) {
                            var data = ppData.resultContent;
                            _this.zhanghaoxinxiList = data;
                        }
                    }, "json");

                    $("#myModalLabel2").html("专家及相关层级经办人联系方式");
                    $("#lianxifangshiModal").modal();
                },

                Export:function(){
                    var _this = this
                    location.href = "/system/daochu/bdshenbaoxinxi?deptid="+_this.deptid
                        +"&zhuanjiamingcheng="+_this.zhuanjiamingcheng
                        +"&biandongleixing="+_this.biandongleixing
                        +"&biandongriqikaishi="+_this.biandongriqikaishi
                        +"&biandongriqijieshu="+_this.biandongriqijieshu
                },
            },
        })
    </script>
</body>
</html>